package com.rky.crowd.mvc.config;

import entity.Admin;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.List;

/**
 * @author 0x_Jss
 * @date 2022年02月16日 15:56
 * @description
 */
public class SecurityAdmin extends User {

    private static final long serialVersionUID = 1L;

    private Admin originalAdmin;

    public SecurityAdmin(Admin originalAdmin, List<GrantedAuthority> authorities){

        super(originalAdmin.getLoginAcct(),originalAdmin.getUserPswd(),authorities);

        this.originalAdmin = originalAdmin;

        // 将原始Admin对象中的密码擦除
         this.originalAdmin.setUserPswd(null);
    }
    public Admin getOriginalAdmin(){
        return originalAdmin;
    }
}